﻿using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Vokabeltrainer
{
    public partial class Tastatur : Form
    {
        public bool Aktiv;
        List<string> comboBoxItemsNamen = new List<string>();
        bool tastenFertig;

        public Tastatur()
        {
            InitializeComponent();
            kopieren.Text = "";
            buttonsAus();
            comboBoxLaden();
        }

        private void comboBoxSpeichern()
        {
            string line = "";
            StreamWriter sw = File.CreateText("Daten/ComboBox.bin");
            for (int i = 0; i < comboBoxItemsNamen.Count; i++)
            {
                line = comboBoxItemsNamen[i];
                sw.WriteLine(line);
            }
            sw.Close();
        }

        private void comboBoxLaden()
        {
            string line = "";
            StreamReader sr = File.OpenText("Daten/ComboBox.bin");
            while (!sr.EndOfStream)
            {
                line = sr.ReadLine();
                comboBox1.Items.Add(line);
                comboBoxItemsNamen.Add(line);
            }
            sr.Close();
        }

        private void TastenSpeichern(string text)
        {
            string line = "";
            StreamWriter sw = File.CreateText("Daten/" + text + ".bin");
            line = button1.Text + ":" +
                button2.Text + ":" +
                button3.Text + ":" +
                button4.Text + ":" +
                button5.Text + ":" +
                button6.Text + ":" +
                button7.Text + ":" +
                button8.Text + ":" +
                button9.Text + ":" +
                button10.Text + ":" +
                button11.Text + ":" +
                button12.Text + ":" +
                button13.Text + ":" +
                button14.Text + ":" +
                button15.Text + ":" +
                button16.Text + ":" +
                button17.Text + ":" +
                button18.Text + ":" +
                button19.Text + ":" +
                button20.Text + ":" +
                button21.Text + ":" +
                button22.Text + ":" +
                button23.Text + ":" +
                button24.Text + ":" +
                button25.Text + ":" +
                button26.Text + ":" +
                button27.Text + ":" +
                button28.Text + ":" +
                button29.Text + ":" +
                button30.Text + ":" +
                button31.Text + ":" +
                button32.Text + ":" +
                button33.Text + ":" +
                button34.Text + ":" +
                button35.Text + ":" +
                button36.Text + ":" +
                button37.Text + ":" +
                button38.Text + ":" +
                button39.Text + ":" +
                button40.Text + ":" +
                button41.Text + ":" +
                button42.Text + ":" +
                button43.Text + ":" +
                button44.Text + ":" +
                button45.Text + ":" +
                button46.Text + ":" +
                button47.Text + ":" +
                button48.Text + ":" +
                button49.Text + ":" +
                button50.Text + ":" +
                button51.Text + ":" +
                button52.Text + ":" +
                button53.Text + ":" +
                button54.Text + ":" +
                button55.Text + ":" +
                button56.Text + ":" +
                button57.Text + ":" +
                button58.Text + ":" +
                button59.Text + ":" +
                button60.Text + ":" +
                button61.Text + ":" +
                button62.Text + ":" +
                button63.Text + ":" +
                button64.Text + ":" +
                button65.Text + ":" +
                button66.Text + ":" +
                button67.Text + ":" +
                button68.Text + ":" +
                button69.Text + ":" +
                button70.Text + ":" +
                button71.Text + ":" +
                button72.Text + ":" +
                button73.Text + ":" +
                button74.Text + ":" +
                button75.Text + ":" +
                button76.Text + ":" +
                button77.Text + ":" +
                button78.Text + ":" +
                button79.Text + ":" +
                button80.Text + ":" +
                button81.Text + ":" +
                button82.Text + ":" +
                button83.Text + ":" +
                button84.Text + ":" +
                button85.Text + ":" +
                button86.Text + ":" +
                button87.Text + ":" +
                button88.Text + ":" +
                button89.Text + ":" +
                button90.Text + ":" +
                button91.Text + ":" +
                button92.Text + ":" +
                button93.Text + ":" +
                button94.Text + ":" +
                button95.Text + ":" +
                button96.Text + ":" +
                button97.Text + ":" +
                button98.Text + ":" +
                button99.Text + ":" +
                button100.Text + ":" +
                button101.Text + ":" +
                button102.Text + ":" +
                button103.Text + ":" +
                button104.Text + ":" +
                button105.Text + ":" +
                button106.Text + ":" +
                button107.Text + ":" +
                button108.Text + ":" +
                button109.Text + ":" +
                button110.Text + ":" +
                button111.Text + ":" +
                button112.Text + ":" +
                button113.Text + ":" +
                button114.Text + ":" +
                button115.Text + ":" +
                button116.Text + ":" +
                button117.Text + ":" +
                button118.Text + ":" +
                button119.Text + ":" +
                button120.Text + ":" +
                button121.Text + ":" +
                button122.Text + ":" +
                button123.Text + ":" +
                button124.Text + ":" +
                button125.Text + ":" +
                button126.Text + ":" +
                button127.Text + ":" +
                button128.Text + ":" +
                button129.Text + ":" +
                button130.Text + ":" +
                button131.Text + ":" +
                button132.Text + ":" +
                button133.Text + ":" +
                button134.Text + ":" +
                button135.Text + ":" +
                button136.Text + ":" +
                button137.Text + ":" +
                button138.Text + ":" +
                button139.Text + ":" +
                button140.Text + ":" +
                button141.Text + ":" +
                button142.Text + ":" +
                button143.Text + ":" +
                button144.Text + ":" +
                button145.Text + ":" +
                button146.Text + ":" +
                button147.Text + ":" +
                button148.Text + ":" +
                button149.Text + ":" +
                button150.Text + ":" +
                button151.Text + ":" +
                button152.Text + ":" +
                button153.Text + ":" +
                button154.Text + ":" +
                button155.Text + ":" +
                button156.Text + ":" +
                button157.Text + ":" +
                button158.Text + ":" +
                button159.Text + ":" +
                button160.Text + ":" +
                button161.Text + ":" +
                button162.Text + ":" +
                button163.Text + ":" +
                button164.Text + ":" +
                button165.Text + ":" +
                button166.Text + ":" +
                button167.Text + ":" +
                button168.Text + ":" +
                button169.Text + ":" +
                button170.Text + ":" +
                button171.Text + ":" +
                button172.Text + ":" +
                button173.Text + ":" +
                button174.Text + ":" +
                button175.Text + ":" +
                button176.Text + ":" +
                button177.Text + ":" +
                button178.Text + ":" +
                button179.Text + ":" +
                button180.Text + ":" +
                button181.Text + ":" +
                button182.Text + ":" +
                button183.Text + ":" +
                button184.Text + ":" +
                button185.Text + ":" +
                button186.Text + ":" +
                button187.Text + ":" +
                button188.Text + ":" +
                button189.Text + ":" +
                button190.Text + ":" +
                button191.Text + ":" +
                button192.Text + ":" +
                button193.Text + ":" +
                button194.Text + ":" +
                button195.Text + ":" +
                button196.Text + ":" +
                button197.Text + ":" +
                button198.Text;
            sw.WriteLine(line);
            line = fertig.Checked.ToString();
            sw.WriteLine(line);
            sw.Close();
        }

        private void TastenLaden()
        {
            string line = "";
            StreamReader sr = File.OpenText("Daten/" + comboBox1.Text+".bin");
            line = sr.ReadLine();
            button1.Text = line.Split(':')[0];
            button2.Text = line.Split(':')[1];
            button3.Text = line.Split(':')[2];
            button4.Text = line.Split(':')[3];
            button5.Text = line.Split(':')[4];
            button6.Text = line.Split(':')[5];
            button7.Text = line.Split(':')[6];
            button8.Text = line.Split(':')[7];
            button9.Text = line.Split(':')[8];
            button10.Text = line.Split(':')[9];
            button11.Text = line.Split(':')[10];
            button12.Text = line.Split(':')[11];
            button13.Text = line.Split(':')[12];
            button14.Text = line.Split(':')[13];
            button15.Text = line.Split(':')[14];
            button16.Text = line.Split(':')[15];
            button17.Text = line.Split(':')[16];
            button18.Text = line.Split(':')[17];
            button19.Text = line.Split(':')[18];
            button20.Text = line.Split(':')[19];
            button21.Text = line.Split(':')[20];
            button22.Text = line.Split(':')[21];
            button23.Text = line.Split(':')[22];
            button24.Text = line.Split(':')[23];
            button25.Text = line.Split(':')[24];
            button26.Text = line.Split(':')[25];
            button27.Text = line.Split(':')[26];
            button28.Text = line.Split(':')[27];
            button29.Text = line.Split(':')[28];
            button30.Text = line.Split(':')[29];
            button31.Text = line.Split(':')[30];
            button32.Text = line.Split(':')[31];
            button33.Text = line.Split(':')[32];
            button34.Text = line.Split(':')[33];
            button35.Text = line.Split(':')[34];
            button36.Text = line.Split(':')[35];
            button37.Text = line.Split(':')[36];
            button38.Text = line.Split(':')[37];
            button39.Text = line.Split(':')[38];
            button40.Text = line.Split(':')[39];
            button41.Text = line.Split(':')[40];
            button42.Text = line.Split(':')[41];
            button43.Text = line.Split(':')[42];
            button44.Text = line.Split(':')[43];
            button45.Text = line.Split(':')[44];
            button46.Text = line.Split(':')[45];
            button47.Text = line.Split(':')[46];
            button48.Text = line.Split(':')[47];
            button49.Text = line.Split(':')[48];
            button50.Text = line.Split(':')[49];
            button51.Text = line.Split(':')[50];
            button52.Text = line.Split(':')[51];
            button53.Text = line.Split(':')[52];
            button54.Text = line.Split(':')[53];
            button55.Text = line.Split(':')[54];
            button56.Text = line.Split(':')[55];
            button57.Text = line.Split(':')[56];
            button58.Text = line.Split(':')[57];
            button59.Text = line.Split(':')[58];
            button60.Text = line.Split(':')[59];
            button61.Text = line.Split(':')[60];
            button62.Text = line.Split(':')[61];
            button63.Text = line.Split(':')[62];
            button64.Text = line.Split(':')[63];
            button65.Text = line.Split(':')[64];
            button66.Text = line.Split(':')[65];
            button67.Text = line.Split(':')[66];
            button68.Text = line.Split(':')[67];
            button69.Text = line.Split(':')[68];
            button70.Text = line.Split(':')[69];
            button71.Text = line.Split(':')[70];
            button72.Text = line.Split(':')[71];
            button73.Text = line.Split(':')[72];
            button74.Text = line.Split(':')[73];
            button75.Text = line.Split(':')[74];
            button76.Text = line.Split(':')[75];
            button77.Text = line.Split(':')[76];
            button78.Text = line.Split(':')[77];
            button79.Text = line.Split(':')[78];
            button80.Text = line.Split(':')[79];
            button81.Text = line.Split(':')[80];
            button82.Text = line.Split(':')[81];
            button83.Text = line.Split(':')[82];
            button84.Text = line.Split(':')[83];
            button85.Text = line.Split(':')[84];
            button86.Text = line.Split(':')[85];
            button87.Text = line.Split(':')[86];
            button88.Text = line.Split(':')[87];
            button89.Text = line.Split(':')[88];
            button90.Text = line.Split(':')[89];
            button91.Text = line.Split(':')[90];
            button92.Text = line.Split(':')[91];
            button93.Text = line.Split(':')[92];
            button94.Text = line.Split(':')[93];
            button95.Text = line.Split(':')[94];
            button96.Text = line.Split(':')[95];
            button97.Text = line.Split(':')[96];
            button98.Text = line.Split(':')[97];
            button99.Text = line.Split(':')[98];
            button100.Text = line.Split(':')[99];
            button101.Text = line.Split(':')[100];
            button102.Text = line.Split(':')[101];
            button103.Text = line.Split(':')[102];
            button104.Text = line.Split(':')[103];
            button105.Text = line.Split(':')[104];
            button106.Text = line.Split(':')[105];
            button107.Text = line.Split(':')[106];
            button108.Text = line.Split(':')[107];
            button109.Text = line.Split(':')[108];
            button110.Text = line.Split(':')[109];
            button111.Text = line.Split(':')[110];
            button112.Text = line.Split(':')[111];
            button113.Text = line.Split(':')[112];
            button114.Text = line.Split(':')[113];
            button115.Text = line.Split(':')[114];
            button116.Text = line.Split(':')[115];
            button117.Text = line.Split(':')[116];
            button118.Text = line.Split(':')[117];
            button119.Text = line.Split(':')[118];
            button120.Text = line.Split(':')[119];
            button121.Text = line.Split(':')[120];
            button122.Text = line.Split(':')[121];
            button123.Text = line.Split(':')[122];
            button124.Text = line.Split(':')[123];
            button125.Text = line.Split(':')[124];
            button126.Text = line.Split(':')[125];
            button127.Text = line.Split(':')[126];
            button128.Text = line.Split(':')[127];
            button129.Text = line.Split(':')[128];
            button130.Text = line.Split(':')[129];
            button131.Text = line.Split(':')[130];
            button132.Text = line.Split(':')[131];
            button133.Text = line.Split(':')[132];
            button134.Text = line.Split(':')[133];
            button135.Text = line.Split(':')[134];
            button136.Text = line.Split(':')[135];
            button137.Text = line.Split(':')[136];
            button138.Text = line.Split(':')[137];
            button139.Text = line.Split(':')[138];
            button140.Text = line.Split(':')[139];
            button141.Text = line.Split(':')[140];
            button142.Text = line.Split(':')[141];
            button143.Text = line.Split(':')[142];
            button144.Text = line.Split(':')[143];
            button145.Text = line.Split(':')[144];
            button146.Text = line.Split(':')[145];
            button147.Text = line.Split(':')[146];
            button148.Text = line.Split(':')[147];
            button149.Text = line.Split(':')[148];
            button150.Text = line.Split(':')[149];
            button151.Text = line.Split(':')[150];
            button152.Text = line.Split(':')[151];
            button153.Text = line.Split(':')[152];
            button154.Text = line.Split(':')[153];
            button155.Text = line.Split(':')[154];
            button156.Text = line.Split(':')[155];
            button157.Text = line.Split(':')[156];
            button158.Text = line.Split(':')[157];
            button159.Text = line.Split(':')[158];
            button160.Text = line.Split(':')[159];
            button161.Text = line.Split(':')[160];
            button162.Text = line.Split(':')[161];
            button163.Text = line.Split(':')[162];
            button164.Text = line.Split(':')[163];
            button165.Text = line.Split(':')[164];
            button166.Text = line.Split(':')[165];
            button167.Text = line.Split(':')[166];
            button168.Text = line.Split(':')[167];
            button169.Text = line.Split(':')[168];
            button170.Text = line.Split(':')[169];
            button171.Text = line.Split(':')[170];
            button172.Text = line.Split(':')[171];
            button173.Text = line.Split(':')[172];
            button174.Text = line.Split(':')[173];
            button175.Text = line.Split(':')[174];
            button176.Text = line.Split(':')[175];
            button177.Text = line.Split(':')[176];
            button178.Text = line.Split(':')[177];
            button179.Text = line.Split(':')[178];
            button180.Text = line.Split(':')[179];
            button181.Text = line.Split(':')[180];
            button182.Text = line.Split(':')[181];
            button183.Text = line.Split(':')[182];
            button184.Text = line.Split(':')[183];
            button185.Text = line.Split(':')[184];
            button186.Text = line.Split(':')[185];
            button187.Text = line.Split(':')[186];
            button188.Text = line.Split(':')[187];
            button189.Text = line.Split(':')[188];
            button190.Text = line.Split(':')[189];
            button191.Text = line.Split(':')[190];
            button192.Text = line.Split(':')[191];
            button193.Text = line.Split(':')[192];
            button194.Text = line.Split(':')[193];
            button195.Text = line.Split(':')[194];
            button196.Text = line.Split(':')[195];
            button197.Text = line.Split(':')[196];
            button198.Text = line.Split(':')[197];
            line = sr.ReadLine();
            fertig.Checked = bool.Parse(line);
            sr.Close();
            tastenFertig = fertig.Checked;
            if (fertig.Checked)
                fertig.Visible = false;
            else
                fertig.Visible = true;
        }

        private void Tastatur_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = true;
        }

        private void kopieren_Click(object sender, EventArgs e)
        {
            if ((comboBox1.Text != "Erweitern") && (comboBox1.Text != "Auswahl") && (!tastenFertig))
            {

                TastenSpeichern(comboBox1.Text);
                tastenFertig = fertig.Checked;
                if (fertig.Checked)
                {
                    buttonsAus();
                    kopieren.Text = "Kopieren";
                    fertig.Visible = false;
                }
            }
            else if (comboBox1.Text == "Erweitern")
            {

                if (textBox2.Text == "")
                    textBox1.Text = "Erst noch Einen Namen Vergeben!!!";
                else
                {
                    comboBoxItemsNamen.Add(textBox2.Text);
                    comboBox1.Items.Add(textBox2.Text);
                    TastenSpeichern(textBox2.Text);
                    comboBoxSpeichern();
                    textBox2.Text = "";
                }
            }
            else
                Clipboard.SetDataObject(textBox1.Text);
        }

        private void button_click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "Erweitern")
                ((Button)sender).Text = textBox1.Text;
            else
                textBox1.Text += ((Button)sender).Text;
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text == "Erweitern")
            {
                buttonsZumErstellen();
                kopieren.Text = "Speichern";
                fertig.Visible = true;
                tastenFertig = false;
            }
            else
            {
                TastenLaden();
                if (fertig.Checked)
                {
                    buttonsAus();
                    kopieren.Text = "Kopieren";
                    fertig.Visible = false;
                }
                else
                {
                    kopieren.Text = "Speichern";
                    buttonsZumErstellen();
                    fertig.Visible = true;
                }
            }
        }

        private void buttonsZumErstellen()
        {
            label1.Visible = true;
            textBox2.Visible = true;
            button1.Visible = true;
            button2.Visible = true;
            button3.Visible = true;
            button4.Visible = true;
            button5.Visible = true;
            button6.Visible = true;
            button7.Visible = true;
            button8.Visible = true;
            button9.Visible = true;
            button10.Visible = true;
            button11.Visible = true;
            button12.Visible = true;
            button13.Visible = true;
            button14.Visible = true;
            button15.Visible = true;
            button16.Visible = true;
            button17.Visible = true;
            button18.Visible = true;
            button19.Visible = true;
            button20.Visible = true;
            button21.Visible = true;
            button22.Visible = true;
            button23.Visible = true;
            button24.Visible = true;
            button25.Visible = true;
            button26.Visible = true;
            button27.Visible = true;
            button28.Visible = true;
            button29.Visible = true;
            button30.Visible = true;
            button31.Visible = true;
            button32.Visible = true;
            button33.Visible = true;
            button34.Visible = true;
            button35.Visible = true;
            button36.Visible = true;
            button37.Visible = true;
            button38.Visible = true;
            button39.Visible = true;
            button40.Visible = true;
            button41.Visible = true;
            button42.Visible = true;
            button43.Visible = true;
            button44.Visible = true;
            button45.Visible = true;
            button46.Visible = true;
            button47.Visible = true;
            button48.Visible = true;
            button49.Visible = true;
            button50.Visible = true;
            button51.Visible = true;
            button52.Visible = true;
            button53.Visible = true;
            button54.Visible = true;
            button55.Visible = true;
            button56.Visible = true;
            button57.Visible = true;
            button58.Visible = true;
            button59.Visible = true;
            button60.Visible = true;
            button61.Visible = true;
            button62.Visible = true;
            button63.Visible = true;
            button64.Visible = true;
            button65.Visible = true;
            button66.Visible = true;
            button67.Visible = true;
            button68.Visible = true;
            button69.Visible = true;
            button70.Visible = true;
            button71.Visible = true;
            button105.Visible = true;
            button106.Visible = true;
            button107.Visible = true;
            button108.Visible = true;
            button109.Visible = true;
            button110.Visible = true;
            button111.Visible = true;
            button112.Visible = true;
            button113.Visible = true;
            button114.Visible = true;
            button115.Visible = true;
            button116.Visible = true;
            button117.Visible = true;
            button118.Visible = true;
            button119.Visible = true;
            button120.Visible = true;
            button121.Visible = true;
            button122.Visible = true;
            button123.Visible = true;
            button124.Visible = true;
            button125.Visible = true;
            button126.Visible = true;
            button127.Visible = true;
            button128.Visible = true;
            button129.Visible = true;
            button130.Visible = true;
            button131.Visible = true;
            button132.Visible = true;
            button133.Visible = true;
            button134.Visible = true;
            button135.Visible = true;
            button136.Visible = true;
            button137.Visible = true;
            button138.Visible = true;
            button139.Visible = true;
            button140.Visible = true;
            button141.Visible = true;
            button142.Visible = true;
            button143.Visible = true;
            button144.Visible = true;
            button145.Visible = true;
            button146.Visible = true;
            button147.Visible = true;
            button148.Visible = true;
            button149.Visible = true;
            button150.Visible = true;
            button151.Visible = true;
            button152.Visible = true;
            button153.Visible = true;
            button154.Visible = true;
            button155.Visible = true;
            button156.Visible = true;
            button157.Visible = true;
            button158.Visible = true;
            button159.Visible = true;
            button160.Visible = true;
            button161.Visible = true;
            button162.Visible = true;
            button163.Visible = true;
            button164.Visible = true;
            button165.Visible = true;
            button166.Visible = true;
            button167.Visible = true;
            button168.Visible = true;
            button169.Visible = true;
            button170.Visible = true;
            button171.Visible = true;
            button172.Visible = true;
            button173.Visible = true;
            button174.Visible = true;
            button175.Visible = true;
            button176.Visible = true;
            button177.Visible = true;
            button178.Visible = true;
            button179.Visible = true;
            button180.Visible = true;
            button181.Visible = true;
            button182.Visible = true;
            button183.Visible = true;
            button184.Visible = true;
            button185.Visible = true;
            button186.Visible = true;
            button187.Visible = true;
            button188.Visible = true;
            button189.Visible = true;
            button190.Visible = true;
            button191.Visible = true;
            button192.Visible = true;
            button193.Visible = true;
            button194.Visible = true;
            button195.Visible = true;
            button196.Visible = true;
            button197.Visible = true;
            button198.Visible = true;
        }

        private void buttonsAus()
        {
            label1.Visible = false;
            textBox2.Visible = false;
            if (comboBox1.Text == "Hiragana" || comboBox1.Text == "Katagana")
                label72.Visible = true;
            else
                label72.Visible = false;

            if (button1.Text == "")
                button1.Visible = false;
            else
                button1.Visible = true;
            if (button2.Text == "")
                button2.Visible = false;
            else
                button2.Visible = true;
            if (button3.Text == "")
                button3.Visible = false;
            else
                button3.Visible = true;
            if (button4.Text == "")
                button4.Visible = false;
            else
                button4.Visible = true;
            if (button5.Text == "")
                button5.Visible = false;
            else
                button5.Visible = true;
            if (button6.Text == "")
                button6.Visible = false;
            else
                button6.Visible = true;
            if (button7.Text == "")
                button7.Visible = false;
            else
                button7.Visible = true;
            if (button8.Text == "")
                button8.Visible = false;
            else
                button8.Visible = true;
            if (button9.Text == "")
                button9.Visible = false;
            else
                button9.Visible = true;
            if (button10.Text == "")
                button10.Visible = false;
            else
                button10.Visible = true;
            if (button11.Text == "")
                button11.Visible = false;
            else
                button11.Visible = true;
            if (button12.Text == "")
                button12.Visible = false;
            else
                button12.Visible = true;
            if (button13.Text == "")
                button13.Visible = false;
            else
                button13.Visible = true;
            if (button14.Text == "")
                button14.Visible = false;
            else
                button14.Visible = true;
            if (button15.Text == "")
                button15.Visible = false;
            else
                button15.Visible = true;
            if (button16.Text == "")
                button16.Visible = false;
            else
                button16.Visible = true;
            if (button17.Text == "")
                button17.Visible = false;
            else
                button17.Visible = true;
            if (button18.Text == "")
                button18.Visible = false;
            else
                button18.Visible = true;
            if (button19.Text == "")
                button19.Visible = false;
            else
                button19.Visible = true;
            if (button20.Text == "")
                button20.Visible = false;
            else
                button20.Visible = true;
            if (button21.Text == "")
                button21.Visible = false;
            else
                button21.Visible = true;
            if (button22.Text == "")
                button22.Visible = false;
            else
                button22.Visible = true;
            if (button23.Text == "")
                button23.Visible = false;
            else
                button23.Visible = true;
            if (button24.Text == "")
                button24.Visible = false;
            else
                button24.Visible = true;
            if (button25.Text == "")
                button25.Visible = false;
            else
                button25.Visible = true;
            if (button26.Text == "")
                button26.Visible = false;
            else
                button26.Visible = true;
            if (button27.Text == "")
                button27.Visible = false;
            else
                button27.Visible = true;
            if (button28.Text == "")
                button28.Visible = false;
            else
                button28.Visible = true;
            if (button29.Text == "")
                button29.Visible = false;
            else
                button29.Visible = true;
            if (button30.Text == "")
                button30.Visible = false;
            else
                button30.Visible = true;
            if (button31.Text == "")
                button31.Visible = false;
            else
                button31.Visible = true;
            if (button32.Text == "")
                button32.Visible = false;
            else
                button32.Visible = true;
            if (button33.Text == "")
                button33.Visible = false;
            else
                button33.Visible = true;
            if (button34.Text == "")
                button34.Visible = false;
            else
                button34.Visible = true;
            if (button35.Text == "")
                button35.Visible = false;
            else
                button35.Visible = true;
            if (button36.Text == "")
                button36.Visible = false;
            else
                button36.Visible = true;
            if (button37.Text == "")
                button37.Visible = false;
            else
                button37.Visible = true;
            if (button38.Text == "")
                button38.Visible = false;
            else
                button38.Visible = true;
            if (button39.Text == "")
                button39.Visible = false;
            else
                button39.Visible = true;
            if (button40.Text == "")
                button40.Visible = false;
            else
                button40.Visible = true;
            if (button41.Text == "")
                button41.Visible = false;
            else
                button41.Visible = true;
            if (button42.Text == "")
                button42.Visible = false;
            else
                button42.Visible = true;
            if (button43.Text == "")
                button43.Visible = false;
            else
                button43.Visible = true;
            if (button44.Text == "")
                button44.Visible = false;
            else
                button44.Visible = true;
            if (button45.Text == "")
                button45.Visible = false;
            else
                button45.Visible = true;
            if (button46.Text == "")
                button46.Visible = false;
            else
                button46.Visible = true;
            if (button47.Text == "")
                button47.Visible = false;
            else
                button47.Visible = true;
            if (button48.Text == "")
                button48.Visible = false;
            else
                button48.Visible = true;
            if (button49.Text == "")
                button49.Visible = false;
            else
                button49.Visible = true;
            if (button50.Text == "")
                button50.Visible = false;
            else
                button50.Visible = true;
            if (button51.Text == "")
                button51.Visible = false;
            else
                button51.Visible = true;
            if (button52.Text == "")
                button52.Visible = false;
            else
                button52.Visible = true;
            if (button53.Text == "")
                button53.Visible = false;
            else
                button53.Visible = true;
            if (button54.Text == "")
                button54.Visible = false;
            else
                button54.Visible = true;
            if (button55.Text == "")
                button55.Visible = false;
            else
                button55.Visible = true;
            if (button56.Text == "")
                button56.Visible = false;
            else
                button56.Visible = true;
            if (button57.Text == "")
                button57.Visible = false;
            else
                button57.Visible = true;
            if (button58.Text == "")
                button58.Visible = false;
            else
                button58.Visible = true;
            if (button59.Text == "")
                button59.Visible = false;
            else
                button59.Visible = true;
            if (button60.Text == "")
                button60.Visible = false;
            else
                button60.Visible = true;
            if (button61.Text == "")
                button61.Visible = false;
            else
                button61.Visible = true;
            if (button62.Text == "")
                button62.Visible = false;
            else
                button62.Visible = true;
            if (button63.Text == "")
                button63.Visible = false;
            else
                button63.Visible = true;
            if (button64.Text == "")
                button64.Visible = false;
            else
                button64.Visible = true;
            if (button65.Text == "")
                button65.Visible = false;
            else
                button65.Visible = true;
            if (button66.Text == "")
                button66.Visible = false;
            else
                button66.Visible = true;
            if (button67.Text == "")
                button67.Visible = false;
            else
                button67.Visible = true;
            if (button68.Text == "")
                button68.Visible = false;
            else
                button68.Visible = true;
            if (button69.Text == "")
                button69.Visible = false;
            else
                button69.Visible = true;
            if (button70.Text == "")
                button70.Visible = false;
            else
                button70.Visible = true;
            if (button71.Text == "")
                button71.Visible = false;
            else
                button71.Visible = true;
            if (button72.Text == "")
                button72.Visible = false;
            else
                button72.Visible = true;
            if (button73.Text == "")
                button73.Visible = false;
            else
                button73.Visible = true;
            if (button74.Text == "")
                button74.Visible = false;
            else
                button74.Visible = true;
            if (button75.Text == "")
                button75.Visible = false;
            else
                button75.Visible = true;
            if (button76.Text == "")
                button76.Visible = false;
            else
                button76.Visible = true;
            if (button77.Text == "")
                button77.Visible = false;
            else
                button77.Visible = true;
            if (button78.Text == "")
                button78.Visible = false;
            else
                button78.Visible = true;
            if (button79.Text == "")
                button79.Visible = false;
            else
                button79.Visible = true;
            if (button80.Text == "")
                button80.Visible = false;
            else
                button80.Visible = true;
            if (button81.Text == "")
                button81.Visible = false;
            else
                button81.Visible = true;
            if (button82.Text == "")
                button82.Visible = false;
            else
                button82.Visible = true;
            if (button83.Text == "")
                button83.Visible = false;
            else
                button83.Visible = true;
            if (button84.Text == "")
                button84.Visible = false;
            else
                button84.Visible = true;
            if (button85.Text == "")
                button85.Visible = false;
            else
                button85.Visible = true;
            if (button86.Text == "")
                button86.Visible = false;
            else
                button86.Visible = true;
            if (button87.Text == "")
                button87.Visible = false;
            else
                button87.Visible = true;
            if (button88.Text == "")
                button88.Visible = false;
            else
                button88.Visible = true;
            if (button89.Text == "")
                button89.Visible = false;
            else
                button89.Visible = true;
            if (button90.Text == "")
                button90.Visible = false;
            else
                button90.Visible = true;
            if (button91.Text == "")
                button91.Visible = false;
            else
                button91.Visible = true;
            if (button92.Text == "")
                button92.Visible = false;
            else
                button92.Visible = true;
            if (button93.Text == "")
                button93.Visible = false;
            else
                button93.Visible = true;
            if (button94.Text == "")
                button94.Visible = false;
            else
                button94.Visible = true;
            if (button95.Text == "")
                button95.Visible = false;
            else
                button95.Visible = true;
            if (button96.Text == "")
                button96.Visible = false;
            else
                button96.Visible = true;
            if (button97.Text == "")
                button97.Visible = false;
            else
                button97.Visible = true;
            if (button98.Text == "")
                button98.Visible = false;
            else
                button98.Visible = true;
            if (button99.Text == "")
                button99.Visible = false;
            else
                button99.Visible = true;
            if (button100.Text == "")
                button100.Visible = false;
            else
                button100.Visible = true;
            if (button101.Text == "")
                button101.Visible = false;
            else
                button101.Visible = true;
            if (button102.Text == "")
                button102.Visible = false;
            else
                button102.Visible = true;
            if (button103.Text == "")
                button103.Visible = false;
            else
                button103.Visible = true;
            if (button104.Text == "")
                button104.Visible = false;
            else
                button104.Visible = true;
            if (button105.Text == "")
                button105.Visible = false;
            else
                button105.Visible = true;
            if (button106.Text == "")
                button106.Visible = false;
            else
                button106.Visible = true;
            if (button107.Text == "")
                button107.Visible = false;
            else
                button107.Visible = true;
            if (button108.Text == "")
                button108.Visible = false;
            else
                button108.Visible = true;
            if (button109.Text == "")
                button109.Visible = false;
            else
                button109.Visible = true;
            if (button110.Text == "")
                button110.Visible = false;
            else
                button110.Visible = true;
            if (button111.Text == "")
                button111.Visible = false;
            else
                button111.Visible = true;
            if (button112.Text == "")
                button112.Visible = false;
            else
                button112.Visible = true;
            if (button113.Text == "")
                button113.Visible = false;
            else
                button113.Visible = true;
            if (button114.Text == "")
                button114.Visible = false;
            else
                button114.Visible = true;
            if (button115.Text == "")
                button115.Visible = false;
            else
                button115.Visible = true;
            if (button116.Text == "")
                button116.Visible = false;
            else
                button116.Visible = true;
            if (button117.Text == "")
                button117.Visible = false;
            else
                button117.Visible = true;
            if (button118.Text == "")
                button118.Visible = false;
            else
                button118.Visible = true;
            if (button119.Text == "")
                button119.Visible = false;
            else
                button119.Visible = true;
            if (button120.Text == "")
                button120.Visible = false;
            else
                button120.Visible = true;
            if (button121.Text == "")
                button121.Visible = false;
            else
                button121.Visible = true;
            if (button122.Text == "")
                button122.Visible = false;
            else
                button122.Visible = true;
            if (button123.Text == "")
                button123.Visible = false;
            else
                button123.Visible = true;
            if (button124.Text == "")
                button124.Visible = false;
            else
                button124.Visible = true;
            if (button125.Text == "")
                button125.Visible = false;
            else
                button125.Visible = true;
            if (button126.Text == "")
                button126.Visible = false;
            else
                button126.Visible = true;
            if (button127.Text == "")
                button127.Visible = false;
            else
                button127.Visible = true;
            if (button128.Text == "")
                button128.Visible = false;
            else
                button128.Visible = true;
            if (button129.Text == "")
                button129.Visible = false;
            else
                button129.Visible = true;
            if (button130.Text == "")
                button130.Visible = false;
            else
                button130.Visible = true;
            if (button131.Text == "")
                button131.Visible = false;
            else
                button131.Visible = true;
            if (button132.Text == "")
                button132.Visible = false;
            else
                button132.Visible = true;
            if (button133.Text == "")
                button133.Visible = false;
            else
                button133.Visible = true;
            if (button134.Text == "")
                button134.Visible = false;
            else
                button134.Visible = true;
            if (button135.Text == "")
                button135.Visible = false;
            else
                button135.Visible = true;
            if (button136.Text == "")
                button136.Visible = false;
            else
                button136.Visible = true;
            if (button137.Text == "")
                button137.Visible = false;
            else
                button137.Visible = true;
            if (button138.Text == "")
                button138.Visible = false;
            else
                button138.Visible = true;
            if (button139.Text == "")
                button139.Visible = false;
            else
                button139.Visible = true;
            if (button140.Text == "")
                button140.Visible = false;
            else
                button140.Visible = true;
            if (button141.Text == "")
                button141.Visible = false;
            else
                button141.Visible = true;
            if (button142.Text == "")
                button142.Visible = false;
            else
                button142.Visible = true;
            if (button143.Text == "")
                button143.Visible = false;
            else
                button143.Visible = true;
            if (button144.Text == "")
                button144.Visible = false;
            else
                button144.Visible = true;
            if (button145.Text == "")
                button145.Visible = false;
            else
                button145.Visible = true;
            if (button146.Text == "")
                button146.Visible = false;
            else
                button146.Visible = true;
            if (button147.Text == "")
                button147.Visible = false;
            else
                button147.Visible = true;
            if (button148.Text == "")
                button148.Visible = false;
            else
                button148.Visible = true;
            if (button149.Text == "")
                button149.Visible = false;
            else
                button149.Visible = true;
            if (button150.Text == "")
                button150.Visible = false;
            else
                button150.Visible = true;
            if (button151.Text == "")
                button151.Visible = false;
            else
                button151.Visible = true;
            if (button152.Text == "")
                button152.Visible = false;
            else
                button152.Visible = true;
            if (button153.Text == "")
                button153.Visible = false;
            else
                button153.Visible = true;
            if (button154.Text == "")
                button154.Visible = false;
            else
                button154.Visible = true;
            if (button155.Text == "")
                button155.Visible = false;
            else
                button155.Visible = true;
            if (button156.Text == "")
                button156.Visible = false;
            else
                button156.Visible = true;
            if (button157.Text == "")
                button157.Visible = false;
            else
                button157.Visible = true;
            if (button158.Text == "")
                button158.Visible = false;
            else
                button158.Visible = true;
            if (button159.Text == "")
                button159.Visible = false;
            else
                button159.Visible = true;
            if (button160.Text == "")
                button160.Visible = false;
            else
                button160.Visible = true;
            if (button161.Text == "")
                button161.Visible = false;
            else
                button161.Visible = true;
            if (button162.Text == "")
                button162.Visible = false;
            else
                button162.Visible = true;
            if (button163.Text == "")
                button163.Visible = false;
            else
                button163.Visible = true;
            if (button164.Text == "")
                button164.Visible = false;
            else
                button164.Visible = true;
            if (button165.Text == "")
                button165.Visible = false;
            else
                button165.Visible = true;
            if (button166.Text == "")
                button166.Visible = false;
            else
                button166.Visible = true;
            if (button167.Text == "")
                button167.Visible = false;
            else
                button167.Visible = true;
            if (button168.Text == "")
                button168.Visible = false;
            else
                button168.Visible = true;
            if (button169.Text == "")
                button169.Visible = false;
            else
                button169.Visible = true;
            if (button170.Text == "")
                button170.Visible = false;
            else
                button170.Visible = true;
            if (button171.Text == "")
                button171.Visible = false;
            else
                button171.Visible = true;
            if (button172.Text == "")
                button172.Visible = false;
            else
                button172.Visible = true;
            if (button173.Text == "")
                button173.Visible = false;
            else
                button173.Visible = true;
            if (button174.Text == "")
                button174.Visible = false;
            else
                button174.Visible = true;
            if (button175.Text == "")
                button175.Visible = false;
            else
                button175.Visible = true;
            if (button176.Text == "")
                button176.Visible = false;
            else
                button176.Visible = true;
            if (button177.Text == "")
                button177.Visible = false;
            else
                button177.Visible = true;
            if (button178.Text == "")
                button178.Visible = false;
            else
                button178.Visible = true;
            if (button179.Text == "")
                button179.Visible = false;
            else
                button179.Visible = true;
            if (button180.Text == "")
                button180.Visible = false;
            else
                button180.Visible = true;
            if (button181.Text == "")
                button181.Visible = false;
            else
                button181.Visible = true;
            if (button182.Text == "")
                button182.Visible = false;
            else
                button182.Visible = true;
            if (button183.Text == "")
                button183.Visible = false;
            else
                button183.Visible = true;
            if (button184.Text == "")
                button184.Visible = false;
            else
                button184.Visible = true;
            if (button185.Text == "")
                button185.Visible = false;
            else
                button185.Visible = true;
            if (button186.Text == "")
                button186.Visible = false;
            else
                button186.Visible = true;
            if (button187.Text == "")
                button187.Visible = false;
            else
                button187.Visible = true;
            if (button188.Text == "")
                button188.Visible = false;
            else
                button188.Visible = true;
            if (button189.Text == "")
                button189.Visible = false;
            else
                button189.Visible = true;
            if (button190.Text == "")
                button190.Visible = false;
            else
                button190.Visible = true;
            if (button191.Text == "")
                button191.Visible = false;
            else
                button191.Visible = true;
            if (button192.Text == "")
                button192.Visible = false;
            else
                button192.Visible = true;
            if (button193.Text == "")
                button193.Visible = false;
            else
                button193.Visible = true;
            if (button194.Text == "")
                button194.Visible = false;
            else
                button194.Visible = true;
            if (button195.Text == "")
                button195.Visible = false;
            else
                button195.Visible = true;
            if (button196.Text == "")
                button196.Visible = false;
            else
                button196.Visible = true;
            if (button197.Text == "")
                button197.Visible = false;
            else
                button197.Visible = true;
            if (button198.Text == "")
                button198.Visible = false;
            else
                button198.Visible = true;
        }
    }
}
